Unable to parse a class

I am trying to parse the following in a .cpp file:

class Foo
{
public:

Foo* foo( Foo* ptr )

{
Foo local = *ptr;

return &local;

}
};

int main( int argc, char** argv )
{
Foo f;
Foo* fPtr = f.foo( &f );
return 0;
}

I have created a CompilerInstance as follows:

    CompilerInstance compilerInstance;
 
    LangOptions languageOptions;
    languageOptions.CPlusPlus = 1;
 
    CompilerInvocation compilerInvocation;
    compilerInvocation.setLangDefaults( languageOptions, IK_CXX );
    compilerInstance.setInvocation( &compilerInvocation );


In my RecursiveASTVisitor, I have overloaded the following: