Given an element, returning the inorder rank of it an in a binary search tree with only two parameters
I'd recommend the following approach. Split up Rank into a public-facing member function and a private-facing member function. The private one's signature is:

template &lt;typename Value&gt;
std::pair&lt;bool, int&gt; RankImpl(BinaryNode* tree, const Value&amp; value);


The public one is:

template &lt;typename Value&gt;
boost::optional&lt;int&gt; Rank(BinaryNode* tree, const Value&amp; value);


(Secondarily, I flipped the order of your arguments, provided better names for them, and am not limiting the value we're looking for to be a Comparable. Rather, anything that is equality-comparable to Comparable should suffice).

The idea of using boost::optional is that it, as a return type, already encompasses what you want in a single type - it tells you if there is or isn't a value (i.e. was value found or not) and if there is a value, what it is (i.e. its rank). We however privately still need a value even in the false case, hence the pair helper function. 

Altogether:

template &lt;typename Value&gt;
boost::optional&lt;int&gt; Rank(BinaryNode* tree, const Value&amp; value)
{
    auto pr = RankImpl(tree, value);
    if (pr.first) {
        return pr.second;
    }
    else {
        return boost::none;
    }
}

template &lt;typename Value&gt;
std::pair&lt;bool, int&gt; RankImpl(BinaryNode* tree, const Value&amp; value)
{
    if (!tree) {
        return {false, 0};
    }

    auto left = RankImpl(tree-&gt;left, value);
    if (left.first) {
        return left;
    }
    else if (tree-&gt;m_element == value) {
        return {true, left.second + 1};
    }        
    else {
        auto right = RankImpl(tree-&gt;right, value);
        return {right.first, left.second + 1 + right.second};
    }
}