least common ancestor in C++ for binary tree