'C++ Vector of Object searching for which object contains a specific last name error C2678 binary '==': no operator found [duplicate]

C++ is not really in my skills, so I have vector of objects which is obviously several copies of a class.

My class is named "Contact", and my function I am property passing in my vector objects as reference.

As soon as I try to add in this find, I guess an error

void Contact::searchContactByLastName(string name, vector<Contact>& allContacts) {

    cout << "In SearchContactByLastName \n";  // 

    unsigned int count = allContacts.size();

    for (unsigned int i = 0; i < count; i++) {
        
        //this works 
        cout << " Last Name " << i << " = " << allContacts[i].getLastName() << endl;
        // THIS IS WHAT DOES NOT WORK, even outside the for loop ....
        if (std::find(allContacts.begin(), allContacts.end(), name) != allContacts.end()) {
            // Found the item
        }
    }


}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source