[ create a new paste ] login | about

Link: http://codepad.org/CMaqow6S    [ raw code | output | fork ]

C++, pasted on Oct 23:
#include <iostream>

using namespace std;

template <class T> struct A;

class B
{
    template <class T> friend class A;

    int x;

public:

    B(int x) : x(x) {}
};

template <class T> struct A
{
    void func(B b) { cout << b.x << endl; }     
};

int main(void)
{
    A<void> a;

    a.func(B(5));

    return 0;
}


Output:
1
5


Create a new paste based on this one


Comments: