Peel the onions and cut into small cubes. Peel the potatoes in the same way and cut into thin slices.
Preheat the oven to 180 °C.
Heat some oil in a large pot and sauté the onion until translucent. Add milk and simmer for about 3 minutes. Now add the potato slices and season with nutmeg, salt and pepper.
Peel the garlic cloves and add them to the pot through a garlic press. Let the mixture simmer gently for about 10 minutes.
Pour the potato and onion mixture, including the liquid, into a greased baking dish.
Sprinkle with the grated cheese and pour whipped cream over it, so it gets a wonderful shiny color.
Bake the potato gratin in the oven for about 30 minutes.