Peel the potatoes and cut into cubes. Cook together with the macaroni in two liters of salted water until soft.
Peel and halve the onions and cut into fine strips. Layer the well-drained pasta and potatoes in layers with the grated cheese in a greased baking dish. Season with salt and pepper to taste in between. Pour the butter and cream over the top and sprinkle with the onion strips.
Briefly bake in a preheated oven at 220 ° C (until the onion strips are golden brown). Serve hot.