Testing equality with a trait object

Or you can use Any:

With impl specialization, you could have default implementations for those methods as well.