Overloading the output operator for a BST

Hi guys, I'm trying to overload the output operator for a BST so it prints out in-order. I've been staring at this for a good hour and can't seem to find the right solution to make it compile, any hints/tips are greatly appreciated.
Here are the three functions I'm working with...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void BST::in_order(std::ostream& os) const
{
    in_order(&os, root);
}

std::ostream& BST::in_order(std::ostream& os, BinNode* node) const
{
    if(node != nullptr)
    {
        in_order(os, node->left);
        os << node->data;
        in_order(node->right);
    }
    return os;
}

std::ostream& operator<<(std::ostream& os, const BST& tree) const
{
    tree.in_order(os);
    return os;
}
Topic archived. No new replies allowed.