Nearly holomorphic modular forms and representations of SL(2,R)