This problem is easier solved using recursion. You are right that calling tree::in_order_print() recursively will not work. What you could do is to create another function that takes a node object as argument (or the function could be a member of the node class). This function could be recursive and the tree::in_order_print() function could call this function once, passing the root as argument.