because variable 'a' was declared inside 'main', a variable is visible only within the enclosing scope block ( the part of program enclosed by braces )
You can pass 'a' as argument to 'child'
Also notice that cout << a will output an address since 'a' is a pointer and that you have a memory leak because you called 'new' without 'delete'
when you're done with the variable. Maybe in this short program it wouldn't be necessary, as the program would end and the space in memory will be freed, but it's good practice to remember to free any dynamically allocated memory.