Sir which header file must be included for this

sir which header file must be included for this operator overloading…

@Vaibhav277 hey ,just include iostream file as there is no special file which is to be included for operator overloading.

sir some error is coming

@Vaibhav277 send error please

#include using namespace std; class node{ public: int data; node *next; node(int d){ data = d; next = NULL; } }; //computing the length of linked list int length(node *head){ node *temp = head; int len = 0; while(temp!=NULL){ temp = temp -> next; len++; } return len; } //insering node at the beginning void insertAtHead(node *&head , int data){ node *n = new node(data); n ->next = head; head = n; } //inserting node at the end void insertAtTail(node *&head , int data){ if(head == NULL){ head = new node(data); return; } node *tail = head; while(tail -> next != NULL){ tail = tail -> next; } node * n = new node(data); tail -> next = n; } //inserting an element at a particular position void insertAtPos(node *&head,int pos,int data){ if(head==NULL || pos == 0){ insertAtHead(head, data); } else if(pos>length(head)){ insertAtTail(head,data); } else{ node * temp = head; int jump = 1; while(jump < pos-1){ temp = temp -> next; jump++; } node *n = new node(data); n -> next = temp -> next; temp -> next = n; } } //printing the linked list void print(node *head){ node *temp = head; while(temp!=NULL){ cout<<temp -> data<<" -> "; temp = temp -> next; } } //deleting the first node void deleteAtHead(node *&head){ if(head == NULL){ return; } else{ node *temp = head; head = head -> next; delete(temp); } } //deleting the last node void deleteAtTail(node *&head){ node * prev = NULL; node * temp = head; while(temp -> next != NULL){ prev = temp; temp = temp -> next; } delete(temp); prev->next = NULL; return ; } //deleting a node at a particular position void deleteAtPos(node * head, int pos){ if(head == NULL || pos == 0){ return ; } else if(pos==length(head)){ deleteAtTail(head); } else{ node * prev = NULL; node * temp = head; int jump = 1; while(jump<=pos-1){ prev = temp; temp = temp -> next; jump++; } prev -> next = temp -> next; delete (temp); return; } } //checking if a particular elements is present is linked list( recursive approach) bool recursiveSearch(node *head,int key){ if(head == NULL){ return false; } if(head -> data == key){ return true; } else{ return recursiveSearch(head->next,key); } } //checking if a particular elements is present is linked list( iterative approach) bool iterativeSearch(node *head,int key){ while(head != NULL){ if(head -> data == key){ return true; } head = head -> next; } return false; } //reversing the linked list iteratively void reverse(node &head){ node * prev = NULL; node * curr = head; node * n; while(curr != NULL){ n = curr -> next; curr -> next = prev; prev = curr; curr = n; } head = prev; } //reversing the linked list recursively node reverseRec(node *head){ if(head -> next == NULL || head == NULL){ return head; } node smallHead = reverseRec(head -> next); node * curr = head; curr -> next -> next = curr; curr -> next = NULL; return smallHead; } //finding the midpoint of the linked list node midpoint(node * head){ if(head==NULL || head->next == NULL){ return head; } node *slow = head; node *fast = head -> next; while(fast!=NULL and fast->next!=NULL){ slow = slow -> next; fast = fast -> next -> next; } return slow; } void kthnodeFromEnd(node *head,int k){ node *slow = head; node *fast = head; int jump = 1; while(jump<=k){ fast = fast -> next; jump++; } while(fast!=NULL){ fast = fast -> next; slow = slow -> next; } cout<data; } //Building Linked list By taking input from user void buildList(node *&head){ int data; cin>>data; while(data!=-1){ insertAtTail(head,data); cin>>data; } } istream& operator>>(istream &is, node *&head){ buildList(head); return is; } ostream operator<<(ostream &os, node *&head){ print(head); return os; } int main() { node *head = NULL; node *head2 = NULL; cin>>head>>head2; cout<<head<<endl<<head2; return 0; }

this is the code… i am not able to share the code from ide

@Vaibhav277 please share on ide ,click on save option and send me link ,this code is coming in one line and not readable.

sir can u tell whats the error in the code

@Vaibhav277 hey there was problem in overloading ,check this out have corrected it: