As a suggestion:
You may want to narrow down your code to where you think the problem is and be specific regarding your expected and observed behavior. 360 lines is a lot to ask people to read. That will help your issue get more attention.
I tried to compile your code and found:
1. On line 292, your .get() function returns a template<class Item>. Since queue is declared with <data> it returns a data object. This isn't a string. I see that you've typedef'd it, but I don't think that matters when dealing with class-defined overloaded operators like string = something.
2. OUTPUT<data> output(QUEUE<data> queue) is a function that returns an OUTPUT<data> object, is named output and takes 1 argument. It isn't part of the OUTPUT class and therefore it does not have access to push, pop, or stack. Try putting calculate. in front of these functions.
You need to explain what you want this to do and you also need to explain in what way or ways the current code is failing. Also provide sample data if needed.