I have the following code:

```
template<class A, class B>
void test(A& a, const B* b)
{ std::cout << "hi" << std::endl; }

template<class A, class B>
void test(A& a, const B** b)
{ std::cout << "hello" << std::endl; }

class TestClass
{};

int main()
{
    int a = 5;
    TestClass b;
    TestClass* c = &b;
    test(a, &c);
    return 0;
}

```

Somehow the output is "hi" although it seems that better match would be the second template function. When I remove `const`s as the qualifiers to `B*` and `B**` then I get "hello" which corresponds to the second template function. How does the compiler choose the function to call in this case? Thanks!