Im doing it this way whats wrong
class Node{
public:
int data;
Node *next;
Node(int n){
data=n;
next=NULL;
}
friend Node* operator+(Node* &, Node* &);
};
Node* addLists(Nodehead1, Nodehead2){
if(head2==NULL)return head1;
if(head1==NULL)return head2;
Node *temp = head1;
while(temp->next!=NULL){
temp=temp->next;
}
temp->next = head2;
return head1;
}
Node* operator+(Node*&head1, Node*&head2){
head1 = addLists(head1,head2);
return head1;
}