Chop the onion and garlic finely.
In a pan, heat the olive oil and sauté the onion and garlic until golden brown.
Season with salt and pepper to taste.
Add the sliced ham to the pan and cook for a few minutes until heated through.
In a separate bowl, whisk together the eggs, milk, flour, and baking powder.
Add the onion, garlic, and ham mixture to the egg mixture and stir to combine.
Grease a baking dish with butter and pour the egg mixture into the dish.
Arrange the cheese slices on top of the mixture.
Bake in a preheated oven at 180°C (350°F) for 40-45 minutes or until the top is golden brown.
Remove from the oven and let cool for a few minutes before serving.
Slice and enjoy!