templatised structs in device mode

Why doesn’t the following exceprt compile?

struct A {

	int begin();

	int a;

};

int A::begin() {return a;}

__device__ void bob() {

	A a;

	a.begin();

}

Error: “error C3861: ‘_ZN1B5beginEv’: identifier not found”?? The strangest part is that if I declare AND define the function inside the struct, everything works correctly? Why doesn’t nvcc allow for definition outside the struct even if it’s in the same file?

I am using CUDA 2.1 beta, but 2.0 had the same issues.

What about

struct A {

	__device__ int begin();

	int a;

};