Make Reference class implement Comparable.

Comparison of references is based on unique id attribute.