Peel and finely slice both types of potatoes, around 2-3mm thick. Place in a bowl and cover with cold water whilst you bring a large pot of water to the boil.
Once boiling drain the potatoes and carefully tip into the boiling pot of water. Boil for 3 minutes and drain. Set aside to cool.
Peel and finely slice the onions. Melt the butter in a medium-sized frying pan and fry the onions over a medium heat until soft and starting to lightly brown, stirring often for around 15 minutes.
Add in the garlic and fry for a further 2 minutes.
Whilst the onions are cooking, preheat the oven to 200℃/180℃ fan (390℉/355℉).
Grease the baking dish with butter or neutral tasting oil.
Arrange 1/3 of the potatoes in concentric circles on the bottom of the dish. Spoon over half of the onions, season with salt and pepper and sprinkle with 1/3 of the cheese. Layer another 1/3 of the potatoes. Top with the rest of the onions, another 1/3 of the cheese and season with salt and pepper. Top with the final layer of potatoes.
Beat the egg into the cream with a fork. Pour it over the potatoes and sprinkle the rest of the cheese on top.
Bake the potatoes for 35 minutes until the cheese is golden and bubbling.