I have been stuck trying to find a solution to an error message I have been getting when trying to pass in a private object pointer from WordTree into a recursive array inside my << overload function.
Header:
struct WordNode
{
    unsigned int count;
    std::string word;
    WordNode* left;
    WordNode* right;
};
class WordTree
{
public:
    WordTree() : root(nullptr) {};
    ~WordTree();
    friend std::ostream& operator <<(std::ostream&, const WordTree&);
    void intorder(std::ostream&, const WordNode*);    //Removed & from WordNode*
private:
    WordNode* root;
};
CPP:
void intorder(ostream&, const WordNode*);    //Was missing from original code
ostream& operator <<(ostream& ostr, const WordTree& tree)
{
    intorder(ostr, tree.root);
    return ostr;
}
void WordTree::intorder(ostream& o, const WordNode* ptr)    //Removed & from WordNode* for this example
{
    if(ptr == nullptr)
        return;
    intorder(o, ptr->left);
    o << ptr->word << " " << ptr->count << "\n";
    intorder(o, ptr->right);
}
Error:
Error LNK2019: unresolved external symbol "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl intorder(class std::basic_ostream<char,struct std::char_traits<char> > &,struct WordNode *)" (?intorder@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV12@PAUWordNode@@@Z) referenced in function "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<char,struct std::char_traits<char> > &,class WordTree const &)" (??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@ABVWordTree@@@Z)
Error LNK1120: 1 unresolved externals //The exe file
How should I implement my code so that the ptr accessing the data members would work while at the same time making sure that the root of my WordTree is passed properly?
