C++ Binary Tree Template with a Leaf Counter