I've got a class called Stock and within that class i have a an operator overloader for cout (operator<<) and it works if i pass it an Stock object, but if i pass it a Stock pointer, cout just prints the address of the pointer rather than calling the overloaded operator. Is this expected?
Here is the prototype
1 2 3 4 5 6 7 8
friend std::ostream & operator<<(std::ostream &os, Stock & st);
//main program
Stock st1;
Stock * st2;
... more code
cout << st1; //works calls the overloaded operator
cout << st2; //just prints the address, doesnt call the overloaded operator.