Pre-heat your oven to 350°F (180°C) with a rack in the middle. You'll need an un-greased loaf pan (mine is non-stick).
Make the caramel: Put the sugar in a small VERY CLEAN saucepan over medium heat. Then do not touch it...no stirring. You can occasionally shake the pan once it starts melting. Let the sugar melt, bubble, and eventually turn a medium golden color. Watch it carefully and when the caramel turns amber, immediately remove from the heat and pour the caramel evenly over the bottom of the loaf pan. Set aside to cool and harden.
Separately, boil some water to have ready. I use an electric kettle, which is super easy, but if you have to use the stove it can take a few minutes. You'll need this for the bain-marie to bake the flan in.
Make the flan: In a large bowl, add the sweetened condensed milk, coconut milk, eggs, vanilla extract and shredded coconut. Whisk together and then pour the mixture into the loaf pan on top of the hardened caramel.
Get out a larger dish, like a 9x13. Place the loaf pan into the larger dish, and fill the larger baking dish with your boiling water at least 1/4 up the side of the loaf pan. The boiling water creates a nice steamy environment AND makes a gentler baking environment to avoid splitting or curdling.
Bake for 50 to 55 minutes, until the top crust is lightly golden and firm to the touch and there's a slight wobble but not massive jiggling. If the top of your flan starts browning too fast, put a sheet of foil on top for the remainder of baking.
Transfer the loaf pan to a cooling rack (discard the hot water from the shallow pan) and let it cool to room temperature, then transfer to the fridge and chill for at least 4 hours.
Serve: When you're ready to serve, get a your shallow baking dish again and get some warm water in it (doesn't have to be super hot). Briefly hold the bottom of the loaf pan in about 2 inches of hot (but not boiling) water, just to get the caramel to soften slightly so it will release from the pan. For me this only takes about 15-30 seconds but if it takes you a bit longer, don't panic.
Run a knife around the edges of the pan and then invert the loaf pan on a plate or dish, holding tightly and quickly turning over (you don't want the liquid caramel to spill everywhere).
If desired, sprinkle with shredded coconut before serving. Slice and serve.