'C++ Iterating over a unique pointer

How come I can't access the getType method in itr when iterates over unique_pointer? How can I fix it. Thank you in advance for your response. The whole program https://onecompiler.com/cpp/3y2qdtuer

class CDataType
{
      public:
              
      const string getType();
        
      protected:
           string m_Type;
           size_t m_Size;
};
class CDataTypeStruct : public CDataType
{
      public:
           virutal const string getType();
                
      protected:
           list<unique_ptr<CDataType>> m_Field;
           unordered_set<string> m_Field_names;
};
const string CDataType::getType()
{
      return m_Type;
}
const string CDataTypeStruct::getType()
{
      return m_Type;
}
CDataType& CDataTypeStruct::field(const string name) const
{
     list<unique_ptr<CDataType>>::const_iterator itr = m_Field.begin();
     for(; itr != m_Field.end(); ++itr)
     {
            
          if(itr->getType() == name)
          break;
     }
    
     if(itr == m_Field.end())
     cout << "Vyjimka" << endl;
        
     return *itr;
            
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source