As Salem mentioned, it is important to paste your code without formatting as that screws up the site's formatting. It even seems to remove some spacing.
The pointer variable 'root' has an address in memory that is totally independent on the value that it contains, just like an int has an address in memory and a totally separate value.
Code:
int n = 42;
cout << &n << '\n'; // the address of n
cout << n << '\n'; // the value of n (an integer)
node *root = new node("root");
cout << &root << '\n'; // the address of root
cout << root << '\n'; // the value of root (address of a 'node' object)
Furthermore, the delete operation does not modify the value of 'root'. All it does is mark the deallocated memory as ready for reuse. (This may actually change the value stored there as part of the allocation system's bookkeeping.)
Code:
delete root;
cout << &root << '\n'; // the address of root, obviously not changed
cout << root << '\n'; // root's value has also not been changed, although
// it is an error to dereference it after delete
The addresses of the members of an object are just offsets from the object's base address. So printing &root->children will just add children's offset to the value of root whether or not root points to valid memory (i.e., root is not actually dereferenced in that expression).
Programmers will often set a pointer to nullptr after a delete to ensure that they get a segfault if it is dereferenced after deletion:
Code:
delete root;
root = nullptr;
But even after this, &root->children will still give a value. That value will be 0 (nullptr) plus the offset of children.
After the delete operation (but without setting root to nullptr) cout << root->name may still yield the "correct" value or a distorted value or possibly segfault. It is "undefined behavior" and could do "anything" (well, at least those three things).