I am using G++ Compiler in LINUX. Why does this section of code causes this error template with C linkage?

Code:
template <class T>
class CObjectCreator : public CCacheObjectCreator
{
    T* CreateCacheObject(LPCSTR pszKey, LPCSTR pszExtra) { return new T(pszKey, pszExtra); }
};
Code:
template <class T>
class CAllocator : public CCacheAllocator
{
public:
    CAllocator(CCache* pCache, LPCSTR pszKey, LPCSTR pszExtra, DWORD dwExpirySecs, T*& pObject) : CCacheAllocator(pCache, pszKey, pszExtra, dwExpirySecs, new CObjectCreator<T>(), (CCacheObject *&)pObject) {}
};