Dice the ham or cut into fine strips. Peel and finely dice the onion. Cook the spaghetti in salted water according to package instructions until al dente.
Heat 20 g butter. Sauté the onion cubes in it while stirring until translucent. Add the ham cubes and fry briefly. Pour in the cream and let the sauce simmer for about 1 minute.
Whisk the eggs and egg yolk vigorously. First whisk with a few tablespoons of hot ham and cream sauce to prevent the sauce from curdling. Then add the egg mixture to the hot ham-cream sauce, stirring constantly.
The sauce should now no longer boil. Add the Parmesan cheese and season with salt and pepper. Drain the spaghetti and drain well. Place in a warmed bowl and mix with the softened butter. Immediately mix with the ham and cream sauce.