Adds compareTo method to sort this object