Set both slices bread, buttered side down, in a large skillet set to medium-high heat. Cover each piece of bread with 1 slice cheese, 3 slices ham, and top slice of bread, buttered side up. Cook sandwiches until bottom is golden brown and cheese is melted, about 2 minutes per side.
Place sandwiches on an oven-safe plate. Spread a thin layer of mayonnaise on the top of each sandwich, and then place a slice of cheese on top. (This is a croque monsieur. To make a croque madame, read on!)
Melt 1 tablespoon butter in same skillet over medium-high heat. Cook each egg sunny side up. Turn egg over and cook 1 minute longer for a soft-cooked egg, or 3 minutes longer for a hard-cooked egg.
Place 1 fried egg atop each sandwich. Season egg, to taste, with salt and pepper. Serve sandwich immediately.