If you define your operator= function inside your class definition, declare it this way:
class list { ... list& operator=(const list&) { ... return *this; } };
If you define your operator= function outside the definition of your class, declare it as in this complete and correct example:
class list { public: list& operator=(const list&); }; list& list::operator=(const list&) { return *this; } int main() {}
source share