It seems to have solved the problem by removing it from the .h file. What is namespace std used for because I am getting confused about when to use it and when not to.
its used when you use #include<iostream> it is used for 'cin','cout' and 'endl' etc and as in discard.h file you were not using any i/o stream so it shouldn't be there.