How can I get pointer to object in friend function?
def.h
class A
{
public:
template <typename some_type_t>
friend void foo(some_type_t &val);
A();
virtual ~A();
private:
int x;
inline A* GetSelfPtr(){return this;}
};
class B
{
public:
template <typename some_type_t>
friend void foo(some_type_t &val);
B();
virtual ~B();
private:
int x;
inline B* GetSelfPtr(){return this;}
};
#include "templt.h"
templt.h
template <typename some_type_t>
void foo(some_type_t &val)
{
GetSelfPtr()->x;
}
error: there are no arguments to ‘GetReqPtr’ that depend on a template parameter, so a declaration of ‘GetReqPtr’ must be available [-fpermissive]