Updated my Code which now gives me an error at S.push\_back(qElem(str));

I am trying to create a += operator in order to push a string into my stack but I am having the most difficult time at succeeding. I keep receiving errors. For example, from my code below I am receiving an error within main.cpp at (FIXED):

```
sta += "Clean";  //ERROR STATES: No viable overloaded '+='

```

Then with different code at different times I will receive an error at (FIXED):

```
S.push_back(qElem(str)); //ERROR STATES: No matching conversion for functional-style cast from 'std::__1::basic_string<char>' to 'qElem'

```

I am just having a really hard time with the operator, any help on how to make this work would be greatly appreciated.

main.cpp

```
#include "queue.h"
#include "stack.h"

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
    string more;
    string task;
    int priority;
    string yes;

    int stack;

    PriQueue<string> que;
    Stack<string> sta;

    do { //Do while loop, to enter more tasks

        cout << "Would you like to add to the stack or the priority queue (1/2)?" << endl;
        cout << "1. Stack" << endl; cout << "2. Priority Queue" << endl;
        cin >> stack;

        if (stack == 1) {
            sta += "Clean";
            sta.peek();

        }

        else
        {
            //Taking in the task
            cout << "What is your task in ONE word?" << endl;
            cin >> task;

            cout << "What is the priority level of the task on a scale from 1 to 10 (10 = highest priority)?" << endl;
            cin >> priority;
            //Taking in the priority
            if (priority > 10 || priority < 1) {
                priority = 5;
                cout << "Invalid Priority Level, Automatically set to 5." << endl;
            }

            que.enqueue(task, priority); //Taking and storing the task

        }

        cout << "Would you like to RUN this again (y/n)?" << endl;
        cin >> more;

    } while (more == "y" || more == "Y" || more == "Yes" || more == "yes"); //End of loop response

    que.size(); //Returning your the number of tasks you have

    que.peek(); //Returning your first task

    cout << "Would you like us to delete your first task (y/n)?" << endl; //Using "dequeue" for example
    cin >> yes;
    if (yes == "y" || yes == "Y" || yes == "Yes" || yes == "yes") {

        que.dequeue(); //Deleting your first task

        que.peek(); //Returning your NEW first task
    }

    else {cout << "Thank You, Goodbye" << endl;}

    return 0;
}

```

stack.h

```
#ifndef Queue_stack_h
#define Queue_stack_h

#include "queue.h"
#include "error.h"

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
class Stack : private vector<qElem>
{
    vector<qElem> S;

public:
    Stack<T> push(T str);
    void pop();
    void peek();

    Stack<T> operator += (const T& str);

    Stack<T> operator -= (string const &str);

};

template<class T>
Stack<T> Stack<T>::push(T str)
{
    S.push_back(qElem(str));

}

template<class T>
void Stack<T>::pop()
{
    if (S.empty()) {  //First check if stack is empty, if not, print out frist in stack
        cout << "You have none in stack!" << endl;
    }

    else {
        cout << "FIRST IN STACK: " << S.front() << endl;
    }

    S.erase(S.begin()); //Now erase first in stack

    if (S.empty()) {
        cout << "You have NONE in STACK!" << endl;
    }

    else {

    }

}

template<class T>
void Stack<T>::peek()
{
    if (S.empty()) {  //First check if stack is empty, if not, print out frist in stack
        cout << "You have no stack!" << endl;
    }

    else {
        cout << "FIRST IN STACK: " << &S.front() << endl;
    }

}

template<class T>
Stack<T> Stack<T>::operator += (const T& str)
{
    this->push(str);
    return *this;

}

template<class T>
Stack<T> Stack<T>::operator -= (string const &str)
{

}

#endif

```