Preheat the oven to 350°F (175°C) and grease an 8×8-inch baking dish.
In a large bowl, whisk together the eggs, heavy cream, melted butter, and sugar until smooth.
Stir in the salt, black pepper, and flour until fully combined.
Add the drained whole kernel corn and creamed corn, mixing gently to combine.
Fold in the shredded cheddar cheese if using.
Pour the mixture into the prepared baking dish and smooth the top evenly.
Bake uncovered for 40–45 minutes, until the center is set and the top is lightly golden.