In a heavy, deep pot or Dutch oven, gently heat the butter and olive oil and add the onions, garlic and salt.
Keeping the heat on the lowest level cook these for 40 minutes to an hour, till they gradually turn the colour of dark caramel. Do NOT cook on high heat as this will burn the onions and turn them bitter.
Once the onions have reached the desired colour and softness, add the flour and stir for a minute.
Now pour in a quarter of the wine (the heat must still be low) and stir so that it combines the onions, flour and the sticky fried bits into one mixture.
Cook for 2 minutes for the sharpness of the alcohol to go and then pour in the stock and the remaining wine. Check the salt, add pepper and more salt if required, and with the lid partially open, simmer the soup very gently for half an hour.
Just before serving, slice the baguette into thick slices - 1 slice per bowl if it’s a wide loaf or 2-3 slices if it’s narrow. The idea is for the bread to cover most of the surface area of the bowl.
Switch on the broiler in your oven and place a baking sheet under it. Toast the bread under the broiler.
Now, working quickly, divide the shredded meat (if using) at the bottom of the soup bowls and drizzle lightly with brandy. Ladle the soup into the bowls till almost full, top with the toasted bread and sprinkle generously with cheese. Place the bowl on the baking sheet under the broiler till the cheese is molten, golden and bubbling. Serve immediately.