Optical detection of magnetic resonance in a single molecule