i viewed all other threads related to my problem, such as:

[Overloading the << operator](https://stackoverflow.com/questions/19436393/overloading-the-operator)

[operator << overload](https://stackoverflow.com/questions/2695753/operator-overload)

and i feel im so close to solve my problem, but no success. i hope you guys can assist.

i have the following example code, and i need to make him compile:

```
auto fan3 = std::make_shared<Fan>(3,"Not Connected");

//.... lots of code

std::cout << "User: " << *fan3 << " not connected" << std::endl;

```

i was getting the error "Invalid operands to binary expression ('basic\_ostream >' and 'mtm::Fan')", so i figured i need to implement the << operator.

i tried to put the following in fan.h:

```
friend std::ostream& operator<<(std::ostream& os, Fan& fan);

```

but im getting "undefined symbols". putting it outside of the class (without 'friend' ofcourse) results in same error.

i guess there is something i dont quite understand about this kind of behaviour - i did implemnet other operator overloading, but << is just giving me troubles so far.

please, explain to me what i am missing and how to resolve this issue. 
Thank you for your time!