setting varaible from another script

I have been making a card game where I have scriptable objects storing the values for the card stats. However, I have an array to simulate a card stack being shuffled and cards taken one at a time. When I try to add the object from the array onto the card, it comes up with an error:

cardPrefab.GetComponent<CardDisplay>().card = activeCard;

cardPrefab is the card that will display the values.
CardDisplay is the script on the card which has the variable “card”. This is what the scriptable object should be applied to.
activeCard is the scriptable object chosen from the array.

Error:

Assets/CardGame/Scripts/CardStackClick.cs(16,50): error CS0266: Cannot implicitly convert type `UnityEngine.ScriptableObject' to `CardStats'. An explicit conversion exists (are you missing a cast?)

So activeCard is actually referenced as ScriptableObject instead of CardStats? If that’s the case: cardPrefab.GetComponent<CardDisplay>().card = activeCard as CardStats; should work.