В вашем классе вы можете перегрузить символ "& lt;" оператора.
class MyClass { bool operator <(const MyClass& rhs) { return this->key < rhs.key; } }