You can do that by using css.
Depending on your menu structure, you can use the .current-page-item class to hide or show children.
If A is not clicked, it DOESN’T have the .current-page-item class. So you could do something like
li.page_item ul.children {
display: none;
visibility: hidden;
}
That hides the children of regular page items.
After you have clicked A, it has the class .current-page-item. Then you can do this
li.current_page_item ul.children {
display: block;
visibility: visible;
}
It will show children of the current page, while children of other pages are hidden.
This code came straight from twentyten. You might not have the class .children for the subpages if you are using a different theme. Then you would have to do it in a different way…
Good luck
Anja