Slice the onions in half, lengthwise. Place, cut side down, on a cutting board and slice crosswise into very thin slices.
In large non-stick skillet, combine butter, cloves, onions, thyme and salt. Cover and cook over low heat until onions are very soft, about 10 minutes. Taste and adjust seasonings.
Transfer onion mixture to a gratin dish and smooth it. The recipe can be prepared several hours up to this point. Cover and store at room temperature.
Preheat the broiler. In a small bowl, combine egg yolks and cream and whisk well. Stir in the cheese.
Pour the mixture over the onions in the baking dish. Place dish under broiler about 2 inches from the heat.
Broil until the top is sizzling and golden. Serve immediately as a vegetable course or as an accompaniment to meat dishes.