Weird behaviour of clear function in vector

Consider below code

#include<bits/stdc++.h>
using namespace std;

int main()
{
vector arr = {1, 2, 3, 4, 5};
arr.clear();

for (int i = 0; i < 5; i++) cout << arr[i] << " ";

return 0;

}

We have cleared the vector arr, still we are able to access all elements of arr.
Can anyone tell me, why?