Preheat the oven to 200°C, 400°F, Gas 6, Butter an 18cm x 26cm (7in x 10in) ovenproof dish.
Divide the peeled and sliced potatoes into four lots, and divide the anchovies into two lots. Arrange a quarter of the potatoes in the bottom of the dish, then place half of the anchovies on top of these, in three lines, evenly spaced across the width of the dish. Season with salt – not too much, as the anchovies will be quite salty – and some freshly ground black pepper.
Add another layer of potatoes, then three more lines of anchovies, running the opposite direction to the previous layer. Season again, then add another layer of potatoes.
Next, add the finely chopped garlic, sprinkling it evenly across the potatoes, season again, then add the last layer of potatoes. Pour the cream into the dish, then sprinkle the grated Parmesan and Gruyere cheeses over the top.
Cover the dish with tinfoil and put it in the oven. After 30 minutes, remove the tinfoil and cook for a further 30 minutes, or until the potatoes are tender when pierced with a skewer and the surface of the dish is golden brown and bubbling.