Override equals and hashcode so they can be used in sets properly.