can u pass template class objects as parameters to friend functions of the same class??
i tried sumthin like...
template<class T>
class array
{
T a[10];
int n;
public:
friend istream& operator>>(istream&,array&);
friend ostream& operator<<(ostream&,array&);};
istream& operator >>(istream& din,array& b)
{
din>>b.n ; //size of array
for(inti=0;i<b.n;i++)
din>>b.a[i];
return(din);
}
ostream& operator<<(ostream &dout,array &b)
{
for(int i=0;i<b.n;i++)
dout<<b.a[i]<<" ";
}
void main()
{
array<int> iarray;
cin>>iarray;
cout<<iarray;}