1. Cut the endives in half lengthwise and cook them in boiling salted water for about 20 minutes. Once cooked, drain them for about 1 hour.
2. Peel the potatoes and immerse them in boiling salted water for about 1 hour. Once cooked, drain them for about 10 minutes.
3. Preheat the oven to 180°C (350°F).
4. Prepare a béchamel sauce:
5. In a saucepan, melt the butter and then add the flour.
6. Gradually add the milk to the mixture.
7. Stop when the béchamel becomes liquid.
8. Roll each endive in a slice of ham.
9. Cut the potatoes in half.
10. Put everything in an oven-safe dish and cover with béchamel sauce.
11. Sprinkle everything with grated cheese.
12. Let the gratin cook for about 30 minutes.