Heat the butter and oil in a large heavy-based pan over medium heat. Add all the sliced onions and stir to coat.
Cook the onions for 30-35 minutes, stirring every few minutes, until they are deeply golden and caramelised. Do not rush this step.
Sprinkle over the sugar and flour, stir well and cook for 1 minute.
Gradually pour in the stock, stirring constantly. Bring to a simmer and cook for 10 minutes. Season with salt and pepper.
Ladle the soup into ovenproof bowls. Top each with a slice of bread and a generous handful of grated cheese.
Grill for 2-3 minutes until the cheese is bubbling and golden.