Manage input values from file according to number of elements per line
You can simplify your loops logic like this

while (getline(inFile, inLine)) {
    std::istringstream inStream(inLine);

    anObject inObj;
    if((inStream &gt;&gt; inObj.one) &amp;&amp; (inStream &gt;&gt; inObj.two)) {
        objList.push_back(inObj);
    }
    else {
        myVar = inObj.one;
    }
}


relying on exactly that form of input you mentioned is given.



std::ios::in is redundant for std::ifstream:

inFile.open("myFile.txt", std::ios::in); 
                     // ^^^^^^^^^^^^^^


also open() isn't explicitely needed. You can simply write:

std::ifstream inFile("myFile.txt"); 




class anObject
{
public:
    int one;
    int two;
};


can be simpler written as struct:

struct anObject
{
    int one;
    int two;
};