Basically this function will take the current node (which already has size 1), then add the number of nodes to the left and right of this node. Line by line:
int numNodes() const {
Declares the function numNodes(). This function is valid for any node in the tree, and every node may have a left child, a right child, or both.
int size = 1;
Since we're operating on a node, we know the size is going to start at 1 (this node).
if (left != NULL) size += left->numNodes();
if (right != NULL) size += right->numNodes();
Gets the number of nodes from both the left and right children, if they exist. This is the recursive call - it runs this same method on both child nodes and returns the result. If there are no children, numNodes() will return 1.
return size;
Gives back the size of the tree rooted at this node. Eventually, after all the recursive calls, calling numNodes() on the root of the entire tree will return the total number of nodes.