#include <iostream>
using namespace std;

class base
{
    public:
    template<class T> int func();
    //       ^^^^^
    //       use class keyword

}; // <-- semicolon here

template<class T>
//       ^^^^^
//       use class keyword
int base::func()
{
	cout << "base::func called" << endl;
    return 0;
}

class derived : public base
//                    ^
//                    no colon here
{
public:
    void  caller()
    { 
        func<int>(); // it works
        base::func<int>();    // this works too
    }
}; // <-- semicolon here


int main()
{
	derived d;
	d.caller();
}