I want to show result is 2. (Now result is 1.)
How should I do? (I want to call B::test(). But Actually code cannot access b.h, b.c in main.c)
also I want to know that error from "public: virtual int test() {return 1;}" to "protected: virtual int test() {return 1;}" in a.h
the inheritance relationship are super class A sub class B super class A sub class C
but I can access A class in main.c I want to result 2. ("a.test()" could not call "b.test()")
// a.h
#ifndef _A_
#define _A_
class A {
    public:
        A() {};
        ~A() {};
    //protected:
        virtual int test() {return 1;}
    private:
        friend class B;
};
#endif
// b.h
#ifndef _B_
#define _B_
#include "a.h"
class B : public A {
    public:
        B() {};
        ~B() {};
    private:
        int test() override;
        friend class A;
};
#endif
// b.c
#include "b.h"
int B::test()
{
    return 2;
}
// c.h
#ifndef _C_
#define _C_
#include "a.h"
class C : public A {
    public:
        C() {};
        ~C() {};
    private:
        int test() override;
        friend class A;
};
#endif
// c.c
#include "c.h"
int C::test()
{
    return 3;
}
// main.c
#include <iostream>
#include "a.h"
using namespace std;
int main(void)
{
    A *a = new A();
    cout << a->test() << "\n";
    return 0;
}