Support comparing objects of different types in compare