I've a parent object (Product) and a child (Inventory). I'm trying to retrieve the value of the child object from a class that I've created.

    public class DisplayProducts {
        private Product__c products;

    public DisplayProducts(Product__c item) {
        this.products = item;
       
    }
  
    // Properties for use in the Visualforce view
    public String name {
        get { return products.Name; }
    }
  
    public String colour {
    //error here
            get { return  products.Inventorys__r.Colour__c; }
    
        }

However I keep getting a compile error: invalid FK relationship. Why is that so?

When I retrieve the object using SOQL statement it works perfectly.

    Select Name,  (SELECT Inventory__c.Colour__c FROM Product__c.Inventorys__r)  From Product__c];

but why it doesn't work in the Display Class? Thank you.