Updated "equals" function for Relation class.