“No viable overloaded ‘=’ ” why?

I’m making a project for one of my classes and I’m pretty sure I’m almost done with the project. Basically I have to input 2 people’s tickets and I have to find the maximum and minimum price. I need to overload the * and / operators to fix that issue for the project. Also, the friend declaration is a necessity for this project via teacher’s instructions.

Now, for the issue. I’m trying to store the proper ticket variable (either t1 or t2) into t3 so I can return that to the main. When I use “=” to set either t1 to t3, it says “no viable overloaded ‘='”. The following is my code:

#include <iostream>

using namespace std;

class ticket
    double input();
    double output();
    friend ticket operator *(const ticket &t1, const ticket &t2);
    friend ticket operator /(const ticket &t1, const ticket &t2);
    void cost();
    string name;
    double miles, price;
    int transfers;

int main()
    ticket customer1, customer2, customer3;

    cout << "*** Customer 1 ***" << endl;
    cout << "--- Entered, thank you ---" << endl;

    cout << "*** Customer 2 ***" << endl;
    cout << "--- Enter, thank you ---" << endl;

Leave a Comment