Carbon stars as standard candles: I. The luminosity function of carbon stars in the Magellanic Clouds | Synapse