In reply to sanketshah:
The object you want to compare needs to have virtual do_compare method. It knows the fields in the object and do_compare gets called by uvm_in_order_class_comparator
See http://www.doulos.com/knowhow/sysverilog/uvm/easier_uvm_paper/DVCon-2011-Easier-UVM-v3.pdf