For the bechamel sauce: Melt the butter in a small pot. Add the onion and cook over low heat to sweat them. Stir in the flour and cook for 1 to 2 minutes. Slowly stir in the milk and bring to a simmer. Cook until smooth and thickened, 10 to 15 minutes, and then season with salt, pepper and nutmeg, if using.
For the sandwich: Heat the oven to high broil.
Build each sandwich as follows: Spread 1 teaspoon of Dijon mustard on a piece of bread; top with 1 slice of Gruyere, 4 ounces ham, another slice of Gruyere and then a piece of bread. Melt half the butter in a large skillet. Add the sandwiches and toast to a golden brown. Flip and brown on the second side. Remove the sandwiches from the pan and place on a rimmed baking sheet.
Spoon 1/3 cup of the bechamel sauce over the top of each sandwich. Broil the sandwiches to brulee the bechamel.
Meanwhile, melt the remaining 4 tablespoons butter in the skillet and cook the eggs over-easy. Remove the sandwiches from the broiler and top with the over-easy eggs.
Recipe courtesy of Robert Irvine