== only measures if two objects are equal, whereas <=> should return -1 if the first object is smaller, 0 if they are equal, and 1 if the first object is larger.
If you define a <=> method for your class, you also define all other comparison operators ( == , < , > , etc.).
source share