In the following code:
#include<iostream>
#include<queue>
using namespace std;
int main()
{
    queue<int> q;
    int a = 5;
    q.push(a);
    cout << q.front() << endl;    // 5
    int* b = &(q.front());
    q.pop();
    cout << *b;          // Outputs 5 but why ?
}
Is a copy of 'a' created inside the queue when I pass 'a' into it ? And when I pop out 'a', then why I am able to dereference the pointer to get the correct output i.e. 5. All I know is that pop() calls the destructor .
Please help !
 
    