Slice the onions in half lenghwise, then cut crosswise into thin slices.
In a large skillet melt butter, then add in onions, thyme, cloves, pepper and salt; cover with lid and saute until the onions are very soft (about 10-12 minutes) adjust the salt to taste (do not add in too much salt as the Parmesan is salty!).
Transfer the onions to a buttered gratin dish or small casserole dish and smooth it out with a spoon.
At this point you can cover and let sit at room temperature to broil later.
Preheat the broiler.
In a small bowl whisk together egg yolks and whipping cream, the stir in Parmesan cheese.
Pour the mixture over the onions in the baking dish.
Place under the broiler (about 2-inches from heat).