Sorry to be so pedantic about this but I am really puzzled.
You're not pedantic, so don't worry ;-)
The template file is just that: a template. It's only purpose is to give you a few code files with ready-made code when you create a new page. It's in no way used or around anymore at run-time. Think of it as a Microsoft Word Template: it's just a starting point for new files. So, all it does is give you a new ASPX page where the code behind class inherits BasePage which takes me to your next question.
No, .NET does not support multiple inheritance (although you can implement multiple interfaces). So, a page called MyPage.aspx could have a code behind class called MyPage. This class in turn inherits BasePage which in turn inherits System.Web.UI.Page (which in turn inherits from another class). The full hierarchy is like this:
Master Pages don't participate in the class hierarchy of a Page. Instead, they form their own hierarchy:
If you had the need, you could create your own BaseMasterPage class and let your custom master page inherit from that page. Since you typically only have a few master pages, I usually don't do this though.
At run-time, the Master Page and Content Page are merged to form one complete page. So, code wise they are not related (they don't inherit from each other), but feature-wise they are related of course as together the form the final presentation of the page.
Does this help?