Question: Is there any way in C# that I can take an empty image and for example draw lines onto it? If possible can you show me an example on how to do this? I've seen something like this before but I don't know to much on how to do it and everywhere online I found was doing it from a pre existing image, then drawing over it. I don't want to have to load anything, just a nice little thing for an interface I'm working on. I know it sounds like I'm asking for code, but all I'm asking for is how to draw an image without loading anything.

Answer: 
A friend function should be defined outside, you could hit issues like [Access friend function defined in class](https://stackoverflow.com/questions/7785886/access-friend-function-defined-in-class) . You should just leave a friend declaration within the class and define the function outside the class.

But your error comes due to the way you name your template variables.

Instead of 

```
friend ostream & operator << <T,size>(ostream & or ,const Queue<T,size> &a){

```

try just 

```
friend ostream & operator << (ostream & or ,const Queue<T,size> &a){

```

p.s. `_Num` - [Bad Idea](https://stackoverflow.com/a/228797/1520364)
If you are concerned about tight coupling like me, you are especially concerned about `friend` (because that's the tightest coupling C++ has to offer). That said, there is a view of `operator<<` that makes it easy to implement, inside the class, without any friend declarations:

Simply put, `operator<<` for ostream is a mere beautification for a simple print method. And it is only because of this beautification (chaining `os << a << b << c...` calls) that the operator can't be a method of the class it should be part of. So many people resort to a friend declaration of that operator, which imo is an encapsulation breaking ugly workaround. So what can you do?

```
template <class T, int size>
class Queue
{
public:
    /**
     * Here comes the method. Inside the class, were it should be, 
     * having all the access it needs. 
     * No template-specialization-friend-declaration needed.
     */
    ostream & printToStream(ostream & or) const 
    { 
        for(int i=0;i<a._Num;i++)
            or<<Arr_[i];
        return or;
    }

private:
    T Arr_[size];
    int _Num;
};

/**
 * Here comes operator<<. It is what it really is:
 * Just a beautification, nothing more, no additional functionality.
 */
template <class T, int size> 
ostream& operator<<(ostream& os, Queue<T,size> const& q)
{ return q.printToStream(os); }

```

See? No big deal at all. If you do that often, and if your method is called printToStream every time, you can make it a template:

```
template <class Printable>
ostream& operator<<(ostream& os, Printable const& p)
{ return p.printToStream(os); }

```

And if you want to get fancy, you can enable\_if that operator [only if it has that member function](http://www.gockelhut.com/c++/articles/has_member). No more "friend operator<< how should I do that again?", just implement printToStream, and the beautification-operator<< already exists.