C++私有继承后为啥访问出错。求大神指点。另外怎么实现对基类私有成员的访问

C++私有继承后为啥访问出错。求大神指点。。。另外如何实现对基类私有成员的访问
#include<iostream>
using namespace std;
class A
{
public:
void get(){x=3, y=4,z=5;}
int x;
protected:
int y;
private:
int z;
};
class B:private A
{
public:
int fun1(){return x;}
    int fun2(){return y;}
};
void main()
{
B b;
b.fun1();
cout<<b.fun1()<<endl;
b.fun2();
cout<<b.fun2()<<endl;
}
------解决思路----------------------
引用:
怎么修改???可以写一下吗


#include<iostream>
using namespace std;
class A
{
    public:
        A(){x=3,y=4,z=5;}
        int a_getz() {return z;}
        int x;
    protected:
        int y;
    private:
        int z;
};
class B:private A
{
    public:
        int fun1(){return x;}
        int fun2(){return y;}
        int getz(){return a_getz();}
};
int main(int argc, char *argv[])
{
    B b;
    b.fun1();
    cout<<b.fun1()<<endl;
    b.fun2();
    cout<<b.fun2()<<endl;
    cout<<b.getz()<<endl;

    return 0;
}