How do I specialize a function template in c++?

```
#include <iostream>

template <int X = 0>  //Wrong attempt, does not compile.
int func(int y)
{
    return X + y;
}

template<int X>
int func(int y)
{
    return X + func<X-1>(y);
}

int main()
{
    std::cout << func<1>(2);
    return 0;
}

```

I would like the result of this program to be: 1 + 0 + y = 3.

For y = 2 it would be: 2 + 1 + 0 + y.

I know there are better ways to do this calculation, I am trying to understand this aspect of the language.