Q:

Is it possible to overload the [] operator to access a specific bit of a char without defining a class? 

I have been given an exercise that includes a lot of fiddling (looking at) with bits in a char[n].  
I have to check some geometrical properties of a bit[n][8] obtained by taking each char, and splitting it into it's bits.  I know that I can access bit[a] of the char c by doing something like c&((1<<8)>>n). 
I would like to know if there is a way of making c[n] actually be c&((1<<8)>>n).  I tried bool operator [](char c,int n); but that gave me this:
error: ‘bool operator[](char, int)’ must be a nonstatic member function
bool operator [](char c,int n);

A:

As the error message says, operator[] must be a member function of a class or struct, and it must take one parameter.  However, you can write a free named function (i.e. not an operator) to do what you want.