In reply to dave_59:
Thanks Vinay & Dave,
I had covergroup inside the class. Defining it outside worked.