templates: add base, derived and final class templates