Serialization: Directly compare objects instead of using a functor duplicating the compare operators.

No functionality change.