Can't access method from class attached to an object

using UnityEngine;
using System.Collections;

public class Card3d : MonoBehaviour {

	public int cardNumber; 

	public void setCardNumber() {
		
		
	}
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnMouseOver () {

		}

	
}



// in a separate file

                newcard.AddComponent<Card3d> ();
		var c3d = newcard.GetComponents<Card3d> ();
		c3d.cardNumber = 1;

it tells me Card3d doesn’t have cardNumber declared. can anyone tell me why?

Instead of var c3d, try explicitly telling the compiler that it’s a card3d object:

Card3d c3d = newcard.GetComponent<Card3d>();