Check for object type during comparison