Peel and slice the onion. Wash, core, and slice the apple. De-rind the bacon and cut into 1/2 in (1.25cm) pieces. Heat the oil or butter in a frying pan over a moderate heat. Add the bacon, onion and apple, and fry, stirring occasionally, until soft (about 5 minutes). Stir in the salt, pepper and sugar.
Remove from the heat. Break the eggs into a cup, one at a time, and pour on top of the onion mixture. Cover the pan with a lid, and cook for a further 3-5 minutes over a very low heat, until the eggs are as firm as you like them.