User Relationship

if I were you, I would use the wp_usermeta table. it is possible to add information to this table easily:

add_user_meta(NEW_USER_ID, "PARENT_USER_ID",USER_ID,true);

USER_ID: the Id of top level user, (In your case id of user A)
“PARENT_USER_ID”: some key that you could search and find result based on
NEW_USER_ID: The Id of sub_user
true: To let many user be sub user of the same user

for instance if USER A id is 41, and the Id of new user (which is B) is 82 your code look like:

add_user_meta(82, "PARENT_USER_ID",41,true);

then you can search for all users which their PARENT_USER_ID is user_id (in our example 41) and then you will get all sub users for that user.

sample query:

$user_query = new WP_User_Query( array( 'meta_key' => 'PARENT_USER_ID', 'meta_value' => '41' ) );