Added class checking to __eq__ function