Well there is no set way to do this, and I doubt there is a tutorial on a system such as this there are tutorials however on basic membership systems.
I would go about this using a single table. Something like the following
Small basic example
userid | username | subuserid
Now all users and users that have created extra accounts will all be in this table. Now if it is a main account that a user has logged into the subuserid of that account would be lets say -1 so all main accounts will be -1 or 0 if you would prefer it.
Now that you want subuser accounts, the subuserid would be the userid of the main account so example.
We have a main account with a username of main_user who than has 2 sub accounts lets give them the username my_sub_1 and my_sub_2 and this is what it would look like in a sort of sql table format
userid | username | subuserid
-----------------------------------------
1 | main_user | -1
2 | my_sub_1 | 1
3 | my_sub_2 | 1
As you can see the 2 sub accounts have the subuserid of the main accounts userid. This is just a basic database example of course you can use it and modify it as much as you want to get it to work how you want.
I hope this helps start you off.