bool operator<(const Person &other) const {
 if (name == other.name) { 
    return age < other.age;
 } else { 
        return name < other.name; 
    }
} 
 
//This fixes the problem: In template: invalid operands to binary     expression ('const Person' and 'const Person')