1. Boil the potatoes in a large pot of salted boiling water for 10 minutes.
2. Drain them and let them cool down.
3. Peel them and slice them.
4. Peel and chop the garlic.
5. Heat 2 tablespoons of olive oil in a frying pan.
6. Sauté the garlic for 2 minutes.
7. Add the potatoes and ham cubes and cook for 5 minutes.
8. Remove from heat and transfer everything to a gratin dish.
9. Preheat the oven to 180°C (350°F).
10. Mix the ricotta, heavy cream, egg yolks, salt, and pepper in a bowl.
11. Pour the mixture over the potatoes in the dish and sprinkle with chopped parsley.
12. Bake for 30 to 40 minutes.
13. Serve hot.