Simple and lightweight factory class, featuring automatic type casting. Written in C++11